﻿using NUnit.Framework;
using Sanelib.Common.Extensions;
using Sanelib.Common.Helpers;
using UnitTest.Entity;

namespace UnitTest.Extensions
{
    [TestFixture]
    public class ReflectionTester
    {
        [Test]
        public void CopyWithPreserve()
        {
            var src = new StudentRoster
            {
                Id = GuidComb.New(),
                Address = "Address",
                Limit = 10,
                Name = "Name",
                Role = "Role"
            };

            var dest = new StudentRoster
            {
                Name = "",
                Address = "AddressShouldNotChange"
            };

            src.Update(dest, true);

            Assert.AreEqual(src.Name, dest.Name);
            Assert.AreEqual(src.Limit, dest.Limit);
            Assert.AreNotEqual(src.Address, dest.Address);
        }

        [Test]
        public void CopyWithoutPreserve()
        {
            var src = new StudentRoster
            {
                Id = GuidComb.New(),
                Address = "Address",
                Limit = 10,
                Name = "Name",
                Role = "Role"
            };

            var dest = new StudentRoster();

            src.Update(dest);

            Assert.AreEqual(src.Name, dest.Name);
        }
    }
}